<template>
  <div class="dataProgress">
    <h1 style="color: red">注:统计值为本级和下级的数量。调查新增为清查阶段没有， 只调查阶段新增的数据，包括:系统预置县域和乡域基础指标统计表、年度和重大历史灾害、 用户自行新增数据等。更新频率为每天5:00、22:00更新</h1>
    <el-table
        :data="tableData"
        row-key="id"
        border
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        style="width: 100%;margin-top: 10px"
        :header-cell-style="cellStyle"
        :header-row-style="{background:'#DCDFE6'}"
    >
      <!-- 区划信息 -->
      <el-table-column
          prop="areaName"
          label="区划名称"
          align="center"
          min-width="100"
      />
      <el-table-column
          prop="areaCode"
          label="区划代码"
          align="center"
          min-width="100"
      />

      <!-- 预置数据相关列 -->
      <el-table-column
          prop="precastCount"
          label="预置数据总量"
          align="center"
          min-width="120"
      >
      </el-table-column>
      <el-table-column
          prop="precastApprovalCount"
          label="预置数据-已审核"
          align="center"
          min-width="140"
      />
      <el-table-column
          prop="precastCancelCount"
          label="预置数据-已核销"
          align="center"
          min-width="140"
      />

      <!-- 调查新增相关列 -->
      <el-table-column
          prop="addCount"
          label="调查新增数据"
          align="center"
          min-width="120"
      >
      </el-table-column>
      <el-table-column
          prop="addSubmitCount"
          label="调查新增-已填报"
          align="center"
          min-width="140"
      />
      <el-table-column
          prop="addWaitSubmitCount"
          label="调查新增-待填报"
          align="center"
          min-width="140"
      />

      <!-- 进度相关列 -->
      <el-table-column
          prop="investCount"
          label="调查数据总量"
          align="center"
          min-width="120"
      />

      <el-table-column
          prop="investProgress"
          label="调查进度"
          align="center"
          min-width="100"
      >
      </el-table-column>

      <el-table-column
          prop="checkProgress"
          label="原检通过率"
          align="center"
          min-width="100"
      >
        <template #default="scope">
          <span>{{ scope.row.checkProgress }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script lang="ts">
import {Component, Vue,Prop} from 'vue-property-decorator';
import {progressStatistic} from '@/api/investDataCommon';
@Component
export default class DataProgress extends Vue {
  tableData: any = []
  @Prop() private row: any;
  refresh(){
    progressStatistic(this.row).then(res =>{
      if(res && res.data){
        this.tableData = res.data;
      }
    }).catch(e =>{
      console.error(e);
    })
  }

  cellStyle({ row, column }) {
    // 为特定列添加样式
    if (column.property === 'totalPreset' || column.property === 'newSurveyData') {
      return {
        color: '#F56C6C'
      }
    }
    return {
      color: '#333333'
    }
  }
}
</script>
<style lang="scss" scoped>
.dataProgress{
  overflow: auto;
}
</style>
